<template>
  <div class="fillcontain">
<!--    <el-form style="margin-left: 20px; width: 100%">-->
<!--      <el-row>-->
<!--        <el-col :span="5">-->
<!--          <el-form-item label="店铺ID">-->
<!--            {{ restaurant_id }}-->
<!--          </el-form-item>-->
<!--        </el-col>-->
<!--        <el-col :span="5">-->
<!--          <el-form-item label="店铺名称">-->
<!--            {{ restaurant_name }}-->
<!--          </el-form-item>-->
<!--        </el-col>-->
<!--        <el-col :span="5">-->
<!--          <el-form-item label="店铺地址">-->
<!--            {{ restaurant_address }}-->
<!--          </el-form-item>-->
<!--        </el-col>-->
<!--      </el-row>-->
<!--    </el-form>-->
    <div style="margin-left: 20px; margin-top: 20px">
      <el-row :gutter="20">
        <el-col :span="6">
          <el-input v-model="queryParams.name" placeholder="食品名称" />
        </el-col>
        <el-col :span="6">
          <el-button
            type="success"
            icon="el-icon-search"
            @click.native="getFoodList"
          >搜索</el-button>
          <el-button
            type="primary"
            icon="el-icon-refresh"
            @click.native="reset"
          >重置</el-button>
        </el-col>
      </el-row>
    </div>
    <br>
    <div class="table_container">
      <el-table
        :data="foodData"
        style="width: 100%"
        border>
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-form label-position="left" inline class="demo-table-expand">
              <el-form-item label="食品名称">
                <span>{{ props.row.name }}</span>
              </el-form-item>
              <el-form-item label="食品价格">
                <span>{{ props.row.price }}</span>
              </el-form-item>
<!--              <el-form-item label="餐馆名称">-->
<!--                <span>{{ props.row.restaurant_name }}</span>-->
<!--              </el-form-item>-->
              <el-form-item label="食品 ID">
                <span>{{ props.row.foodsId }}</span>
              </el-form-item>
              <el-form-item label="店铺ID">
                <span>{{ props.row.restaurantId }}</span>
              </el-form-item>
              <el-form-item label="食品介绍">
                <span>{{ props.row.description }}</span>
              </el-form-item>
<!--              <el-form-item label="餐馆地址">-->
<!--                <span>{{ props.row.restaurant_address }}</span>-->
<!--              </el-form-item>-->
              <el-form-item label="食品评分">
                <span>{{ props.row.rating }}</span>
              </el-form-item>
              <el-form-item label="食品分类">
                <span>{{ props.row.categoryName }}</span>
              </el-form-item>
              <el-form-item label="月销量">
                <span>{{ props.row.monthSales }}</span>
              </el-form-item>
              <el-form-item label="食品库存">
                <span>{{ props.row.num }}</span>
              </el-form-item>
              <el-form-item label="食品图片">
                <el-image
                  style="width: 100px; height: 100px"
                  :src="props.row.imagePath"
                  fit="contain"></el-image>
              </el-form-item>
<!--              <el-form-item label="溯源码">-->
<!--                <span>{{ props.row.traceCode }}</span>-->
<!--              </el-form-item>-->
            </el-form>
          </template>
        </el-table-column>
        <el-table-column label="食品名称" prop="name" />
        <el-table-column label="食品介绍" prop="description" />
<!--        <el-table-column label="追溯状态" prop="state" width="250">-->
<!--          <template slot-scope="scope">-->
<!--            <el-tag-->
<!--              v-if="scope.row.traceCode"-->
<!--              size="middle"-->
<!--              type="success"-->
<!--            >可追溯</el-tag>-->
<!--            <el-tag-->
<!--              v-if="!scope.row.traceCode"-->
<!--              size="small"-->
<!--              type="danger"-->
<!--            >不可追溯</el-tag>-->
<!--            <el-button-->
<!--              v-if="scope.row.traceCode"-->
<!--              size="small"-->
<!--              style="margin-left: 10px"-->
<!--              @click="traceVisible = true"-->
<!--            >查看溯源信息</el-button>-->
<!--          </template>-->
<!--        </el-table-column>-->
<!--        <el-table-column label="溯源码" prop="traceCode" />-->
        <el-table-column label="食品状态" prop="state">
          <template slot-scope="scope">
            <el-tag
              v-if="scope.row.state === 1"
              size="middle"
              type="success"
            >上架</el-tag>
            <el-tag
              v-if="scope.row.state !== 1"
              size="middle"
              type="danger"
            >下架</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="250">
          <template slot-scope="scope">
            <el-button
              size="small"
              @click="handleEdit(scope.row)"
            >编辑</el-button>
            <el-button
              v-if="scope.row.state !== 1"
              size="small"
              type="success"
              @click="changeFoodState(scope.row)"
            >重新上架</el-button>
            <el-button
              v-if="scope.row.state === 1"
              size="small"
              type="danger"
              @click="changeFoodState(scope.row)"
            >下架</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getFoodList" />

      <el-dialog title="修改食品信息" :visible.sync="dialogFormVisible">
        <el-form :model="selectTable">
          <el-form-item label="食品名称" label-width="100px">
            <el-input v-model="selectTable.name" auto-complete="off" />
          </el-form-item>
          <el-form-item label="食品价格" label-width="100px" prop="price">
            <el-input v-model="selectTable.price"></el-input>
          </el-form-item>
          <el-form-item label="食品介绍" label-width="100px">
            <el-input v-model="selectTable.description" />
          </el-form-item>
          <el-form-item label="食品库存" label-width="100px" prop="num">
            <el-input v-model="selectTable.num"></el-input>
          </el-form-item>
          <el-form-item label="食品种类" label-width="100px">
            <el-select
              v-model="selectTable.categoryName"
              placeholder="请选择"
              style="width:100%;"
            >
              <el-option
                v-for="item in categoryList"
                :key="item"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="食品图片" label-width="100px">
            <el-upload
              action="#"
              :on-change="handleChange"
              :auto-upload="false"
              :on-preview="handlePreview"
              list-type="picture-card"
              :on-remove="handleRemove"
              :on-success="onSuccess">
              <i slot="default" class="el-icon-plus"></i>
            </el-upload>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button type="primary" @click="updateFoodInfo">确 定</el-button>
        </div>
      </el-dialog>

      <el-dialog title="查看溯源信息" :visible.sync="traceVisible" width="1050px">
        <iframe frameborder="1" style="width: 1000px; height: 500px" src="http://localhost:9527/" id="myiframe"></iframe>
      </el-dialog>
    </div>
  </div>
</template>

<script>
import { getAllFoods, updateFood } from '../../api/ec/foods'
import { uploadImg } from '../../api/ec/img'

export default {
  name: 'Food',
  data() {
    return {
      categoryList: [
        '热销',
        '主食',
        '饮料'
      ],
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        foodsId: null,
        name: null,
        price: null,
        imagePath: null,
        restaurantId: null,
        monthSales: null,
        description: null,
        rating: null,
        state: null,
        num: null,
        categoryId: null,
        categoryName: null,
        count: null
      },
      traceVisible: false,
      fileMgrUrl: '',
      foods: [
        {
          traceCode: '202110220932230001',
          traceState: '正常',
          name: '大米',
          category: '谷类作物',
          produceDate: '2021-10-21',
          expirationDate: 365,
          description: '东北长粒香大米',
          quality: 5,
          unit: '2.6kg/袋',
          imagePath: 'https://img0.baidu.com/it/u=2619541925,3772815902&fm=253&fmt=auto&app=120&f=JPEG?w=400&h=400',
          state: 1
        },
        {
          traceCode: null,
          traceState: '正常',
          name: '赣南脐橙',
          category: '谷类作物',
          produceDate: '2021-10-21',
          expirationDate: 365,
          description: '新鲜赣南脐橙',
          quality: 5,
          unit: '2.6kg/袋',
          imagePath: 'https://img0.baidu.com/it/u=2619541925,3772815902&fm=253&fmt=auto&app=120&f=JPEG?w=400&h=400',
          state: 1
        }
      ],
      uploadHeaders: {
        Authorization: ''
      },
      restaurantId: 1,
      restaurant_name: 'www',
      restaurant_address: 'dd',
      city: {},
      offset: 0,
      limit: 20,
      count: 0,
      foodData: [
        {
          name: '测试',
          image_path: '166e454b93920826.jpg',
          online: true,
          restaurant_id: '2373',
          category_id: '2312',
          item_id: '1177',
          specfoods: '[ { \'restaurant_id\' : { \'$numberInt\' : \'2373\' }, \'food_id\' : { \'$numberInt\' : \'5314\' }, \'sku_id\' : { \'$numberInt\' : \'5314\' }, \'item_id\' : { \'$numberInt\' : \'1177\' }, \'name\' : \'测试\', \'specs_name\' : \'默认\', \'_id\' : { \'$oid\' : \'5be0573ad1bd6f06de76032c\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'849\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 1.9, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '43',
          description: '测试测试',
          rating: '4.4'
        },
        {
          name: '测试',
          image_path: '166e45569d120827.jpg',
          online: true,
          restaurant_id: '2373',
          category_id: '2313',
          item_id: '1178',
          specfoods: '[ { \'restaurant_id\' : { \'$numberInt\' : \'2373\' }, \'food_id\' : { \'$numberInt\' : \'5315\' }, \'sku_id\' : { \'$numberInt\' : \'5315\' }, \'item_id\' : { \'$numberInt\' : \'1178\' }, \'name\' : \'测试\', \'specs_name\' : \'默认\', \'_id\' : { \'$oid\' : \'5be05760d1bd6f06de760330\' }, \'specs\' : [ { \'value\' : \'默认\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5be05760d1bd6f06de760331\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'289\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 1.8, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } }, { \'restaurant_id\' : { \'$numberInt\' : \'2373\' }, \'food_id\' : { \'$numberInt\' : \'5316\' }, \'sku_id\' : { \'$numberInt\' : \'5316\' }, \'item_id\' : { \'$numberInt\' : \'1178\' }, \'name\' : \'测试\', \'specs_name\' : \'舒服的\', \'_id\' : { \'$oid\' : \'5be05760d1bd6f06de76032e\' }, \'specs\' : [ { \'value\' : \'舒服的\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5be05760d1bd6f06de76032f\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'709\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'22\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 3.7, \'packing_fee\' : { \'$numberInt\' : \'2\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '358',
          description: '测试测试',
          rating: '4.8'
        },
        {
          name: '葱烧海参',
          image_path: '165dfe89b0117816.png',
          online: true,
          restaurant_id: '2377',
          category_id: '2316',
          item_id: '1181',
          specfoods: '[ { \'restaurant_id\' : { \'$numberInt\' : \'2377\' }, \'food_id\' : { \'$numberInt\' : \'4428\' }, \'sku_id\' : { \'$numberInt\' : \'4428\' }, \'item_id\' : { \'$numberInt\' : \'1181\' }, \'name\' : \'葱烧海参\', \'specs_name\' : \'套餐一\', \'_id\' : { \'$oid\' : \'5b9dac2cd1bd6f06de7506fd\' }, \'specs\' : [ { \'value\' : \'套餐一\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5b9dac2cd1bd6f06de7506fe\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'331\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 1.9, \'packing_fee\' : { \'$numberInt\' : \'5\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } }, { \'restaurant_id\' : { \'$numberInt\' : \'2377\' }, \'food_id\' : { \'$numberInt\' : \'4429\' }, \'sku_id\' : { \'$numberInt\' : \'4429\' }, \'item_id\' : { \'$numberInt\' : \'1181\' }, \'name\' : \'葱烧海参\', \'specs_name\' : \'套餐二\', \'_id\' : { \'$oid\' : \'5b9dac2cd1bd6f06de7506fb\' }, \'specs\' : [ { \'value\' : \'套餐二\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5b9dac2cd1bd6f06de7506fc\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'44\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'50\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 3.1, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '380',
          description: '',
          rating: '4.5'
        },
        {
          name: ' bf',
          image_path: '165cd2780f217665.png',
          online: true,
          restaurant_id: '7',
          category_id: '2319',
          item_id: '1182',
          specfoods: '[ { \'specs_name\' : \'默认\', \'name\' : \' bf\', \'item_id\' : { \'$numberInt\' : \'1182\' }, \'sku_id\' : { \'$numberInt\' : \'4363\' }, \'food_id\' : { \'$numberInt\' : \'4363\' }, \'restaurant_id\' : { \'$numberInt\' : \'7\' }, \'_id\' : { \'$oid\' : \'5b98e15dd1bd6f06de74f456\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'702\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 3.2, \'packing_fee\' : { \'$numberInt\' : \'2\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '159',
          description: 'bdfb',
          rating: '4.4'
        },
        {
          name: '广东',
          image_path: '165d5fb300517742.png',
          online: true,
          restaurant_id: '2378',
          category_id: '2320',
          item_id: '1187',
          specfoods: '[ { \'restaurant_id\' : { \'$numberInt\' : \'2378\' }, \'food_id\' : { \'$numberInt\' : \'5215\' }, \'sku_id\' : { \'$numberInt\' : \'5215\' }, \'item_id\' : { \'$numberInt\' : \'1187\' }, \'name\' : \'广东\', \'specs_name\' : \'默认\', \'_id\' : { \'$oid\' : \'5bda5a24d1bd6f06de75f1b5\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'589\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'21\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 4.1, \'packing_fee\' : { \'$numberInt\' : \'1\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '658',
          description: '',
          rating: '4.6'
        },
        {
          name: '324',
          image_path: '165d74e2b3f17776.png',
          online: true,
          restaurant_id: '5',
          category_id: '2341',
          item_id: '1189',
          specfoods: '[ { \'specs_name\' : \'默认\', \'name\' : \'324\', \'item_id\' : { \'$numberInt\' : \'1189\' }, \'sku_id\' : { \'$numberInt\' : \'4422\' }, \'food_id\' : { \'$numberInt\' : \'4422\' }, \'restaurant_id\' : { \'$numberInt\' : \'5\' }, \'_id\' : { \'$oid\' : \'5b9b785fd1bd6f06de75009f\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'235\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 4.2, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '445',
          description: '234',
          rating: '4.9'
        },
        {
          name: 'qq',
          image_path: '165dc72229217790.jpg',
          online: true,
          restaurant_id: '5',
          category_id: '2341',
          item_id: '1191',
          specfoods: '[ { \'specs_name\' : \'默认\', \'name\' : \'qq\', \'item_id\' : { \'$numberInt\' : \'1191\' }, \'sku_id\' : { \'$numberInt\' : \'4424\' }, \'food_id\' : { \'$numberInt\' : \'4424\' }, \'restaurant_id\' : { \'$numberInt\' : \'5\' }, \'_id\' : { \'$oid\' : \'5b9cc93dd1bd6f06de7504d8\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'719\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : { \'$numberInt\' : \'3\' }, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '364',
          description: 'qqq',
          rating: '4.7'
        },
        {
          name: '大师傅',
          image_path: '165dc846a3117794.jpg',
          online: true,
          restaurant_id: '4',
          category_id: '2332',
          item_id: '1192',
          specfoods: '[ { \'specs_name\' : \'默认\', \'name\' : \'大师傅\', \'item_id\' : { \'$numberInt\' : \'1192\' }, \'sku_id\' : { \'$numberInt\' : \'4427\' }, \'food_id\' : { \'$numberInt\' : \'4427\' }, \'restaurant_id\' : { \'$numberInt\' : \'4\' }, \'_id\' : { \'$oid\' : \'5b9ccdefd1bd6f06de750522\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'240\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 1.2, \'packing_fee\' : { \'$numberInt\' : \'1\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '325',
          description: '阿萨德',
          rating: '4.7'
        },
        {
          name: '范德萨',
          image_path: '165e146209117819.jpg',
          online: true,
          restaurant_id: '6',
          category_id: '2323',
          item_id: '1193',
          specfoods: '[ { \'specs_name\' : \'默认\', \'name\' : \'范德萨\', \'item_id\' : { \'$numberInt\' : \'1193\' }, \'sku_id\' : { \'$numberInt\' : \'4430\' }, \'food_id\' : { \'$numberInt\' : \'4430\' }, \'restaurant_id\' : { \'$numberInt\' : \'6\' }, \'_id\' : { \'$oid\' : \'5b9e05b0d1bd6f06de75078a\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'546\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 0.6, \'packing_fee\' : { \'$numberInt\' : \'15\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '878',
          description: '发斯蒂芬斯达',
          rating: '4.2'
        },
        {
          name: 'dfadsf dsfsdfa sdfsdafsdaf dsf  dfasdf ',
          image_path: '165e146c38e17820.jpg',
          online: true,
          restaurant_id: '6',
          category_id: '2323',
          item_id: '1194',
          specfoods: '[ { \'specs_name\' : \'默认\', \'name\' : \'dfadsf dsfsdfa sdfsdafsdaf dsf  dfasdf \', \'item_id\' : { \'$numberInt\' : \'1194\' }, \'sku_id\' : { \'$numberInt\' : \'4431\' }, \'food_id\' : { \'$numberInt\' : \'4431\' }, \'restaurant_id\' : { \'$numberInt\' : \'6\' }, \'_id\' : { \'$oid\' : \'5b9e05d9d1bd6f06de75078e\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'245\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 4.6, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '124',
          description: '发顺丰的大',
          rating: '4.1'
        },
        {
          name: '苹果',
          image_path: '165e231795c17825.png',
          online: true,
          restaurant_id: '4',
          category_id: '2332',
          item_id: '1195',
          specfoods: '[ { \'specs_name\' : \'可乐\', \'name\' : \'苹果\', \'item_id\' : { \'$numberInt\' : \'1195\' }, \'sku_id\' : { \'$numberInt\' : \'4432\' }, \'food_id\' : { \'$numberInt\' : \'4432\' }, \'restaurant_id\' : { \'$numberInt\' : \'4\' }, \'_id\' : { \'$oid\' : \'5b9e4200d1bd6f06de7507ea\' }, \'specs\' : [ { \'name\' : \'规格\', \'value\' : \'可乐\', \'_id\' : { \'$oid\' : \'5b9e4200d1bd6f06de7507eb\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'200\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'21\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 0.6, \'packing_fee\' : { \'$numberInt\' : \'1\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } }, { \'specs_name\' : \'雪碧\', \'name\' : \'苹果\', \'item_id\' : { \'$numberInt\' : \'1195\' }, \'sku_id\' : { \'$numberInt\' : \'4433\' }, \'food_id\' : { \'$numberInt\' : \'4433\' }, \'restaurant_id\' : { \'$numberInt\' : \'4\' }, \'_id\' : { \'$oid\' : \'5b9e4200d1bd6f06de7507e8\' }, \'specs\' : [ { \'name\' : \'规格\', \'value\' : \'雪碧\', \'_id\' : { \'$oid\' : \'5b9e4200d1bd6f06de7507e9\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'607\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 1.6, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '465',
          description: '2',
          rating: '4.6'
        },
        {
          name: 'QWEQWEQWE',
          image_path: '167551d3b6422829.png',
          online: true,
          restaurant_id: '1',
          category_id: '2306',
          item_id: '1198',
          specfoods: '[ { \'restaurant_id\' : { \'$numberInt\' : \'1\' }, \'food_id\' : { \'$numberInt\' : \'7975\' }, \'sku_id\' : { \'$numberInt\' : \'7976\' }, \'item_id\' : { \'$numberInt\' : \'1198\' }, \'name\' : \'QWEQWEQWE\', \'specs_name\' : \'默认\', \'_id\' : { \'$oid\' : \'5cb80fa3b87bd91ecd3e2c66\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'764\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 4.6, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '545',
          description: '1232321312312',
          rating: '4.9'
        },
        {
          name: '1111',
          image_path: '165e653a29c17878.jpg',
          online: true,
          restaurant_id: '9',
          category_id: '2360',
          item_id: '1199',
          specfoods: '[ { \'specs_name\' : \'默认\', \'name\' : \'1111\', \'item_id\' : { \'$numberInt\' : \'1199\' }, \'sku_id\' : { \'$numberInt\' : \'4441\' }, \'food_id\' : { \'$numberInt\' : \'4441\' }, \'restaurant_id\' : { \'$numberInt\' : \'9\' }, \'_id\' : { \'$oid\' : \'5b9f50d1d1bd6f06de75101e\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'23\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 1.2, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '568',
          description: '111',
          rating: '4.2'
        },
        {
          name: '32324',
          image_path: '165e72886d117905.png',
          online: true,
          restaurant_id: '9',
          category_id: '2360',
          item_id: '1200',
          specfoods: '[ { \'specs_name\' : \'默认\', \'name\' : \'32324\', \'item_id\' : { \'$numberInt\' : \'1200\' }, \'sku_id\' : { \'$numberInt\' : \'4449\' }, \'food_id\' : { \'$numberInt\' : \'4449\' }, \'restaurant_id\' : { \'$numberInt\' : \'9\' }, \'_id\' : { \'$oid\' : \'5b9f8746d1bd6f06de7511f7\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'888\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 2.6, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '677',
          description: '',
          rating: '4.8'
        },
        {
          name: '李哪吒肉夹馍',
          image_path: '165e772aaba17910.jpg',
          online: true,
          restaurant_id: '3',
          category_id: '2326',
          item_id: '1201',
          specfoods: '[ { \'specs_name\' : \'默认\', \'name\' : \'李哪吒肉夹馍\', \'item_id\' : { \'$numberInt\' : \'1201\' }, \'sku_id\' : { \'$numberInt\' : \'4452\' }, \'food_id\' : { \'$numberInt\' : \'4452\' }, \'restaurant_id\' : { \'$numberInt\' : \'3\' }, \'_id\' : { \'$oid\' : \'5b9f9a5fd1bd6f06de75128c\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'320\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 2.3, \'packing_fee\' : { \'$numberInt\' : \'5\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '557',
          description: '一个顶俩',
          rating: '4.7'
        },
        {
          name: '西瓜丸子1',
          image_path: '165e794387917920.jpg',
          online: true,
          restaurant_id: '2397',
          category_id: '2338',
          item_id: '1202',
          specfoods: '[ { \'restaurant_id\' : { \'$numberInt\' : \'2397\' }, \'food_id\' : { \'$numberInt\' : \'4570\' }, \'sku_id\' : { \'$numberInt\' : \'4570\' }, \'item_id\' : { \'$numberInt\' : \'1202\' }, \'name\' : \'西瓜丸子1\', \'specs_name\' : \'默认\', \'_id\' : { \'$oid\' : \'5ba4ae55d1bd6f06de7534b5\' }, \'specs\' : [ { \'value\' : \'默认\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5ba4ae55d1bd6f06de7534b6\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'620\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 3.8, \'packing_fee\' : { \'$numberInt\' : \'2\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } }, { \'restaurant_id\' : { \'$numberInt\' : \'2397\' }, \'food_id\' : { \'$numberInt\' : \'4571\' }, \'sku_id\' : { \'$numberInt\' : \'4571\' }, \'item_id\' : { \'$numberInt\' : \'1202\' }, \'name\' : \'西瓜丸子1\', \'specs_name\' : \'\', \'_id\' : { \'$oid\' : \'5ba4ae55d1bd6f06de7534b3\' }, \'specs\' : [ { \'value\' : \'\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5ba4ae55d1bd6f06de7534b4\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'264\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 0.4, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '936',
          description: '12321312312312',
          rating: '4.7'
        },
        {
          name: 'qq',
          image_path: '165e8084cf817923.jpg',
          online: true,
          restaurant_id: '2378',
          category_id: '2320',
          item_id: '1203',
          specfoods: '[ { \'restaurant_id\' : { \'$numberInt\' : \'2378\' }, \'food_id\' : { \'$numberInt\' : \'4516\' }, \'sku_id\' : { \'$numberInt\' : \'4516\' }, \'item_id\' : { \'$numberInt\' : \'1203\' }, \'name\' : \'qq\', \'specs_name\' : \'默认\', \'_id\' : { \'$oid\' : \'5ba1fac7d1bd6f06de752149\' }, \'specs\' : [ { \'value\' : \'默认\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5ba1fac7d1bd6f06de75214a\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'482\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'0\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 4.9, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } }, { \'restaurant_id\' : { \'$numberInt\' : \'2378\' }, \'food_id\' : { \'$numberInt\' : \'4517\' }, \'sku_id\' : { \'$numberInt\' : \'4517\' }, \'item_id\' : { \'$numberInt\' : \'1203\' }, \'name\' : \'qq\', \'specs_name\' : \'333\', \'_id\' : { \'$oid\' : \'5ba1fac7d1bd6f06de752147\' }, \'specs\' : [ { \'value\' : \'333\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5ba1fac7d1bd6f06de752148\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'654\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 4.2, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } }, { \'restaurant_id\' : { \'$numberInt\' : \'2378\' }, \'food_id\' : { \'$numberInt\' : \'4518\' }, \'sku_id\' : { \'$numberInt\' : \'4518\' }, \'item_id\' : { \'$numberInt\' : \'1203\' }, \'name\' : \'qq\', \'specs_name\' : \'\', \'_id\' : { \'$oid\' : \'5ba1fac7d1bd6f06de752145\' }, \'specs\' : [ { \'value\' : \'\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5ba1fac7d1bd6f06de752146\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'729\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'19\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : { \'$numberInt\' : \'2\' }, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '64',
          description: 'qq',
          rating: '4.5'
        },
        {
          name: '323',
          image_path: '165eacf5c9e17943.png',
          online: true,
          restaurant_id: '2386',
          category_id: '2334',
          item_id: '1206',
          specfoods: '[ { \'restaurant_id\' : { \'$numberInt\' : \'2386\' }, \'food_id\' : { \'$numberInt\' : \'4484\' }, \'sku_id\' : { \'$numberInt\' : \'4484\' }, \'item_id\' : { \'$numberInt\' : \'1206\' }, \'name\' : \'323\', \'specs_name\' : \'默认\', \'_id\' : { \'$oid\' : \'5ba09c8bd1bd6f06de7517fb\' }, \'specs\' : [ { \'value\' : \'默认\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5ba09c8bd1bd6f06de7517fc\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'348\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 2.9, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } }, { \'restaurant_id\' : { \'$numberInt\' : \'2386\' }, \'food_id\' : { \'$numberInt\' : \'4485\' }, \'sku_id\' : { \'$numberInt\' : \'4485\' }, \'item_id\' : { \'$numberInt\' : \'1206\' }, \'name\' : \'323\', \'specs_name\' : \'\', \'_id\' : { \'$oid\' : \'5ba09c8bd1bd6f06de7517f9\' }, \'specs\' : [ { \'value\' : \'\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5ba09c8bd1bd6f06de7517fa\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'244\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'21\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 3.8, \'packing_fee\' : { \'$numberInt\' : \'2\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '722',
          description: '123',
          rating: '4.5'
        },
        {
          name: 'ew',
          image_path: '165eb76fabd17955.png',
          online: true,
          restaurant_id: '6',
          category_id: '2323',
          item_id: '1209',
          specfoods: '[ { \'specs_name\' : \'默认\', \'name\' : \'ew\', \'item_id\' : { \'$numberInt\' : \'1209\' }, \'sku_id\' : { \'$numberInt\' : \'4487\' }, \'food_id\' : { \'$numberInt\' : \'4487\' }, \'restaurant_id\' : { \'$numberInt\' : \'6\' }, \'_id\' : { \'$oid\' : \'5ba0a19ad1bd6f06de751827\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'511\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 2.5, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '307',
          description: 'asdf',
          rating: '4.4'
        },
        {
          name: '888',
          image_path: '165eb777ee517956.png',
          online: true,
          restaurant_id: '6',
          category_id: '2323',
          item_id: '1210',
          specfoods: '[ { \'restaurant_id\' : { \'$numberInt\' : \'6\' }, \'food_id\' : { \'$numberInt\' : \'10829\' }, \'sku_id\' : { \'$numberInt\' : \'10830\' }, \'item_id\' : { \'$numberInt\' : \'1210\' }, \'name\' : \'888\', \'_id\' : { \'$oid\' : \'5cd246fb635eb146c5e99489\' }, \'specs\' : [ ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'618\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : { \'$numberInt\' : \'4\' }, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '718',
          description: 'sd',
          rating: '4.1'
        },
        {
          name: '麻辣香锅',
          image_path: '165eb9d5d5617968.jpg',
          online: true,
          restaurant_id: '2415',
          category_id: '2369',
          item_id: '1213',
          specfoods: '[ { \'restaurant_id\' : { \'$numberInt\' : \'2415\' }, \'food_id\' : { \'$numberInt\' : \'4634\' }, \'sku_id\' : { \'$numberInt\' : \'4634\' }, \'item_id\' : { \'$numberInt\' : \'1213\' }, \'name\' : \'麻辣香锅\', \'specs_name\' : \'默认\', \'_id\' : { \'$oid\' : \'5ba98238d1bd6f06de753b94\' }, \'specs\' : [ { \'value\' : \'默认\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5ba98238d1bd6f06de753b95\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'144\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 3.4, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } }, { \'restaurant_id\' : { \'$numberInt\' : \'2415\' }, \'food_id\' : { \'$numberInt\' : \'4635\' }, \'sku_id\' : { \'$numberInt\' : \'4635\' }, \'item_id\' : { \'$numberInt\' : \'1213\' }, \'name\' : \'麻辣香锅\', \'specs_name\' : \'ww\', \'_id\' : { \'$oid\' : \'5ba98238d1bd6f06de753b92\' }, \'specs\' : [ { \'value\' : \'ww\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5ba98238d1bd6f06de753b93\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'678\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : 4.1, \'packing_fee\' : { \'$numberInt\' : \'0\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } }, { \'restaurant_id\' : { \'$numberInt\' : \'2415\' }, \'food_id\' : { \'$numberInt\' : \'4636\' }, \'sku_id\' : { \'$numberInt\' : \'4636\' }, \'item_id\' : { \'$numberInt\' : \'1213\' }, \'name\' : \'麻辣香锅\', \'specs_name\' : \'20-40\', \'_id\' : { \'$oid\' : \'5ba98238d1bd6f06de753b90\' }, \'specs\' : [ { \'value\' : \'20-40\', \'name\' : \'规格\', \'_id\' : { \'$oid\' : \'5ba98238d1bd6f06de753b91\' } } ], \'stock\' : { \'$numberInt\' : \'1000\' }, \'checkout_mode\' : { \'$numberInt\' : \'1\' }, \'is_essential\' : false, \'recent_popularity\' : { \'$numberInt\' : \'196\' }, \'sold_out\' : false, \'price\' : { \'$numberInt\' : \'20\' }, \'promotion_stock\' : { \'$numberInt\' : \'-1\' }, \'recent_rating\' : { \'$numberInt\' : \'4\' }, \'packing_fee\' : { \'$numberInt\' : \'2\' }, \'pinyin_name\' : \'\', \'original_price\' : { \'$numberInt\' : \'0\' } } ]',
          month_sales: '550',
          description: '好吃的食物',
          rating: '4.1'
        }
      ],
      currentPage: 1,
      selectTable: {
        foodsId: 0,
        name: 111,
        price: 2,
        imagePath: '',
        restaurantId: 1,
        monthSales: 0,
        description: '',
        rating: 5,
        state: 1,
        num: 1,
        categoryId: '',
        categoryName: ''
      },
      dialogFormVisible: false,
      menuOptions: [],
      selectMenu: {},
      selectIndex: null,
      specsForm: {
        specs: '',
        packing_fee: 0,
        price: 20
      },
      specsFormrules: {
        specs: [{ required: true, message: '请输入规格', trigger: 'blur' }]
      },
      specsFormVisible: false,
      expendRow: [],
      total: 0,
      listQuery: {
        page: 1,
        limit: 20
      },
      imgFile: null
    }
  },
  mounted() {
    this.restaurantId = this.$route.query.restaurantId
    this.queryParams.restaurantId = this.restaurantId
    getAllFoods(this.queryParams).then(response => {
      console.log(response)
      this.foodData = response.rows
      this.total = response.total
    })
  },
  methods: {
    handleChange(file) {
      this.imgFile = file.raw
      const form = new FormData()
      form.append('file', this.imgFile)
      uploadImg(form).then(response => {
        console.log('response')
        console.log(response)
        this.selectTable.imagePath = response.data
      })
      console.log(file)
    },
    handlePreview(file) {
      console.log(file)
    },
    onSuccess(response) {
      console.log('response')
      console.log(response)
    },
    handleRemove(file) {
      console.log(file)
    },
    getTraceInfo() {

    },
    handleEdit(data) {
      this.selectTable = data
      this.dialogFormVisible = true
    },
    updateFoodInfo() {
      updateFood(this.selectTable).then(response => {
        if (response.code === 200) {
          this.$message.success('更新成功')
          this.getFoodList()
        } else {
          this.$message.error('更新失败')
          this.getFoodList()
        }
      })
      this.dialogFormVisible = false
    },
    getFoodList() {
      getAllFoods(this.queryParams).then(response => {
        console.log(response)
        this.foodData = response.rows
        this.total = response.total
      })
    },
    changeFoodState(data) {
      if (data.state === 1) {
        data.state = 0
      } else {
        data.state = 1
      }
      updateFood(data).then(response => {
        if (response.code === 200) {
          this.$message.success('更新成功')
        } else {
          this.$message.error('更新失败')
        }
      })
    }
  }
}
</script>

<style scoped>
  /deep/.demo-table-expand {
    font-size: 0;
  }
  /deep/.demo-table-expand label {
    width: 90px;
    color: #99a9bf;
  }
  /deep/.demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 50%;
  }
  /deep/.table_container {
    padding: 20px;
  }
  .Pagination {
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
  }
  /deep/.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  /deep/.avatar-uploader .el-upload:hover {
    border-color: #20a0ff;
  }
  /deep/.avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 120px;
    height: 120px;
    line-height: 120px;
    text-align: center;
  }
  /deep/.avatar {
    width: 120px;
    height: 120px;
    display: block;
  }
  #iframeA {
    position: absolute;
    transform: scale(.5, .5) translate(-50%, -50%);
    width: 200%;
    height: 200%;
    top: 0;
    left: 0
  }
</style>
